Source File
prometheus.go
Belonging Package
github.com/K-Phoen/grabana/target/prometheus
package prometheus// FormatMode switches between Table, Time series, or Heatmap. Table will only work// in the Table panel. Heatmap is suitable for displaying metrics of the// Histogram type on a Heatmap panel. Under the hood, it converts cumulative// histograms to regular ones and sorts series by the bucket bound.type FormatMode stringconst (FormatTable FormatMode = "table"FormatHeatmap FormatMode = "heatmap"FormatTimeSeries FormatMode = "time_series")// Option represents an option that can be used to configure a prometheus query.type Option func(target *Prometheus)// Prometheus represents a prometheus query.type Prometheus struct {Ref stringHidden boolExpr stringIntervalFactor intInterval stringStep intLegendFormat stringInstant boolFormat string}// New creates a new prometheus query.func ( string, ...Option) *Prometheus {:= &Prometheus{Expr: ,Format: string(FormatTimeSeries),}for , := range {()}return}// Legend sets the legend format.func ( string) Option {return func( *Prometheus) {.LegendFormat =}}// Ref sets the reference ID for this query.func ( string) Option {return func( *Prometheus) {.Ref =}}// Hide the query. Grafana does not send hidden queries to the data source,// but they can still be referenced in alerts.func () Option {return func( *Prometheus) {.Hidden = true}}// Instant marks the query as "instant, which means Prometheus will only return the latest scrapped value.func () Option {return func( *Prometheus) {.Instant = true}}// Format indicates how the data should be returned.func ( FormatMode) Option {return func( *Prometheus) {.Format = string()}}// IntervalFactor sets the resolution factor.func ( int) Option {return func( *Prometheus) {.IntervalFactor =}}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |